public class PreorderTree<Element extends Comparable> extends SortedTree<Element> {
	
	public PreorderTree(Element node) {
		super(node);
	}
	
	public PreorderTree() {
		super();
	}
	
	@Override
	//Mueste entsprechend der Traversierung abgeändert werden
	protected void recAdd(Element newElement, Node currentNode) {
		if (newElement.compareTo(currentNode.getElement()) < 0) {
			if (currentNode.getLeft() == null) {
				Node tempNode = new Node(newElement);
				currentNode.setLeft(tempNode);
				Node lastNode = super.goToLast();
				lastNode.setNext(tempNode);
				tempNode.setPrevious(lastNode);
				
			} else {
				recAdd(newElement, currentNode.getLeft());
			}
		} else {
			if (currentNode.getRight() == null) {
				Node tempNode = new Node(newElement);
				currentNode.setRight(tempNode);
				Node lastNode = this.goToLast();
				lastNode.setNext(tempNode);
				tempNode.setPrevious(lastNode);
			} else {
				recAdd(newElement, currentNode.getRight());
			}
		}
	}
	
	@Override
	public TreeIter contains(Element element) {
		throw new UnsupportedOperationException("Not supported yet.");
	}
	
//	private String recTraverse(Node node) {
//		String temp = node.getLabel();
//
//		if (node.getLeftChild() != null) {
//			temp = temp + " " + recTraverse(node.getLeftChild());
//		}
//		
//		if (node.getRightChild() != null) {
//			temp = temp + " " + recTraverse(node.getRightChild());
//		}
//		return temp;
//	}
}
